How to type cast from absolute number to string

Hello,

I want to search an object having particular ID and Module name. I write following script but its not working because of absolute number. ID of that object is SRS_8 which is not an integer.

Item it=item("Path of module")
Module m1=module(it)
Object o_target=object(SRS_8,m1)

Please let me know what will be the corrections need to do in above script
SystemAdmin - Mon Feb 04 03:31:11 EST 2013

Re: How to type cast from absolute number to string
Johnny_P - Mon Feb 04 04:45:38 EST 2013

Hi,

I don't know if I understand your question correctly, but if you just want to get an object handle by the Absolute Number you have to use just the Absolute Number (= object identifier without the prefix), not the object identifier.

use the following snippet to see the difference:

Object o = current
if (null o) { 
    print "no object selected" 
}
else { 
        string sID = identifier(o)
        string sAbsNum = o."Absolute Number"
        print "Object identifier: " sID "\nAbsolute Number: " sAbsNum"" 
}

To get a handle on an object use:

 

Object object(int absno[,Module m])


BUT: This cast works only if the object is visible in the current view! (deleted objects, filtering, ...)

for example:

 

Item it=item("Path of module")
Module m1=module(it)
Object o_target=object(8,m1) // get a handle on the object with absolute number 8 in module m1


Regards,
Johnny

 

Re: How to type cast from absolute number to string
SystemAdmin - Mon Feb 04 05:06:45 EST 2013

Johnny_P - Mon Feb 04 04:45:38 EST 2013

Hi,

I don't know if I understand your question correctly, but if you just want to get an object handle by the Absolute Number you have to use just the Absolute Number (= object identifier without the prefix), not the object identifier.

use the following snippet to see the difference:

Object o = current
if (null o) { 
    print "no object selected" 
}
else { 
        string sID = identifier(o)
        string sAbsNum = o."Absolute Number"
        print "Object identifier: " sID "\nAbsolute Number: " sAbsNum"" 
}

To get a handle on an object use:

 

Object object(int absno[,Module m])


BUT: This cast works only if the object is visible in the current view! (deleted objects, filtering, ...)

for example:

 

Item it=item("Path of module")
Module m1=module(it)
Object o_target=object(8,m1) // get a handle on the object with absolute number 8 in module m1


Regards,
Johnny

 

Hello Johnny

Thanks for replying. I have also done same thing. I came to know this solution just after posting my question.

Thanks a lot!
Regards,
Hemlata